package com.cailu.rabmq.sender.sender;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cailu.common.constant.SenderConfFanoutExchangeCommon;

/**
 * @author cailu
 * @filename SenderConfExchangeTemplate
 * @description 广播模式
 * @date 2020/3/31 17:45
 */
@Component
public class SenderConfFanoutExchangeTemplate {

	@Autowired
	private AmqpTemplate template;

	/**
	 * 功能描述  配置广播模板
	 * @param str 内容
	 * @return void
	 * @author cailu
	 * @date 2020/3/31 17:47
	 */
	public void sendFanoutExchange(String str) {
		if ("".equals(str) || str == null) {
			template.convertAndSend(SenderConfFanoutExchangeCommon.FANOUT_EXCHANGE, "", "hello,Sxchange~Exchange");
		} else {
			template.convertAndSend(SenderConfFanoutExchangeCommon.FANOUT_EXCHANGE, "", str);

		}
	}

}
